#!/bin/sh

cd ~/workshop/rubish

t_today=`date -I`

t_today=`date -j -v +1d  -f "%Y-%m-%d" $t_today | awk '{print $2 $3}'`

# find ~/workshop/gitee/YY/ ~/workshop/gitee/3place/ |grep md | grep `date |awk '{print $2}'`|sed "/2025/d" |xargs subl

find ~/workshop/gitee/yumo/ ~/workshop/gitee/YY/ ~/workshop/gitee/3place/ |grep md | grep $t_today |sed "/年/d" >/tmp/ot
find ~/workshop/gitee/yumo/ ~/workshop/gitee/YY/ ~/workshop/gitee/3place/ |grep md | grep $t_today |grep "2024" >>/tmp/ot

cat /tmp/ot | xargs subl

find  ~/workshop/gitee/3place/ |grep md | grep $t_today |sed "/年/d" >/tmp/ot
find  ~/workshop/gitee/3place/ |grep md | grep $t_today |grep "2024" >>/tmp/ot

echo "% 第三同读每日阅读" > coread-$t_today.md
echo "% "$t_today >> coread-$t_today.md

for files in `cat /tmp/ot`
do 

	bookname=`echo $files | awk  -F \/ '{print $(NF-2)}'`

	echo "# " $bookname >> coread-$t_today.md

	echo "" >> coread-$t_today.md

	sed -e "/audio/d" $files  |sed -e "/^% /d"  >>coread-$t_today.md 
	echo "\n"  >> coread-$t_today.md
done

pandoc -s coread-$t_today.md  -o ~/workshop/hbaolong.github.io/coread/index.html

